﻿#region Copyright (c) 2000-2013 Developer Express Inc.
/*
{*******************************************************************}
{                                                                   }
{       Developer Express .NET Component Library                    }
{                                                                   }
{                                                                   }
{       Copyright (c) 2000-2013 Developer Express Inc.              }
{       ALL RIGHTS RESERVED                                         }
{                                                                   }
{   The entire contents of this file is protected by U.S. and       }
{   International Copyright Laws. Unauthorized reproduction,        }
{   reverse-engineering, and distribution of all or any portion of  }
{   the code contained in this file is strictly prohibited and may  }
{   result in severe civil and criminal penalties and will be       }
{   prosecuted to the maximum extent possible under the law.        }
{                                                                   }
{   RESTRICTIONS                                                    }
{                                                                   }
{   THIS SOURCE CODE AND ALL RESULTING INTERMEDIATE FILES           }
{   ARE CONFIDENTIAL AND PROPRIETARY TRADE                          }
{   SECRETS OF DEVELOPER EXPRESS INC. THE REGISTERED DEVELOPER IS   }
{   LICENSED TO DISTRIBUTE THE PRODUCT AND ALL ACCOMPANYING .NET    }
{   CONTROLS AS PART OF AN EXECUTABLE PROGRAM ONLY.                 }
{                                                                   }
{   THE SOURCE CODE CONTAINED WITHIN THIS FILE AND ALL RELATED      }
{   FILES OR ANY PORTION OF ITS CONTENTS SHALL AT NO TIME BE        }
{   COPIED, TRANSFERRED, SOLD, DISTRIBUTED, OR OTHERWISE MADE       }
{   AVAILABLE TO OTHER INDIVIDUALS WITHOUT EXPRESS WRITTEN CONSENT  }
{   AND PERMISSION FROM DEVELOPER EXPRESS INC.                      }
{                                                                   }
{   CONSULT THE END USER LICENSE AGREEMENT FOR INFORMATION ON       }
{   ADDITIONAL RESTRICTIONS.                                        }
{                                                                   }
{*******************************************************************}
*/
#endregion Copyright (c) 2000-2013 Developer Express Inc.

using System;
using System.IO;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Markup;
using System.Windows.Media;
using UColor.Core.Helpers;
using UColor.Core.Utils;
namespace UColor.Core.Parts {
	public class BackButton : ButtonExt {
#if !SL
		bool isMain;
#endif
		public BackButton() {
			Stream rdStream = AssemblyHelper.GetResourceStream(typeof(BackButton).Assembly, XamlReaderHelper.GetXamlPath("Window/BackButton.xaml"), true);
			ResourceDictionary rd = (ResourceDictionary)XamlReaderHelper.Load(rdStream);
			if(rd == null) return;
			Style = (Style)rd["BackButton"];
			Content = new Image() { Stretch = Stretch.None, Source = ImageSourceHelper.GetImageSource(AssemblyHelper.GetResourceUri(typeof(BackButton).Assembly, "Images/Back.png")) };
			IsTabStop = false;
#if !SL
			Focusable = false;
#endif
		}
#if !SL
        public bool IsMain
        {
            get { return isMain; }
            set
            {
                isMain = value;
                if (isMain)
                    RegisterMainBackButton();
            }
        }
        void RegisterMainBackButton()
        {
            UCWindow.MainUCWindow.SetMainBackButton(this);
        }
		
#endif
	}
}
